package com.towexin.application.system.controller;

import com.towexin.common.ResultData;
import com.towexin.application.system.service.SystemLogService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author 唐伟鑫
 * @version 1.0
 * @date 2021/4/18 17:43
 */
@RestController
@RequestMapping("log")
public class SystemLogController {
    @Autowired
    private SystemLogService systemLogService;

    @GetMapping("selectPage")
    @RequiresPermissions("system.log.list")
    public ResultData selectAndPage(int page, int limit){
        return ResultData.OK(systemLogService.selectAndPage(page, limit));
    }

    @GetMapping("clear")
    @RequiresPermissions("system.log.clear")
    public ResultData clearLog(){
        return systemLogService.remove(null)?ResultData.OK():ResultData.NO();
    }
}
